import request from '@/utils/request'

// 创建商户
// http://sopen-api.mvtlabs.com/smart/swagger-ui.html#/%E5%95%86%E6%88%B7%E7%AE%A1%E7%90%86/createCustomerUsingPOST
export function createCustomer(params={}) {
  const {
    nickname, //昵称/商户名称
    parentUserId, // 父用户id，选填，注册子用户时必填
    password, // 密码
    username, // 用户名/商户ID
  } = params
  return request({
    url: '/customer/create',
    method: 'post',
    data: params,
  })
}

// export function listCustomer(params={}) {
//   const {
//     username='', // 用户名/商户ID
//   } = params
//   return request({
//     url: '/customer/list',
//     method: 'get',
//     params: {
//       username: ''
//     },
//   })
// }

export function listCustomer(params={}) {
  const {
    username='', // 用户名/商户ID
  } = params
  return request({
    url: '/user/list-page',
    method: 'get',
    params: {
      pageIndex: 0,
      pageSize: 1000,
      ...params
    },
  })
}
// 分页
export function listCustomerPage(params={}) {
  const {
    username,
    pageIndex,
    pageSize,
  } = params
  return request({
    url: '/customer/list-page',
    method: 'get',
    params,
  })
}

// 删除
export function deleteCustomer(params={}) {
  const {
    id, // 商户id
  } = params
  return request({
    url: '/customer/delete',
    method: 'delete',
    data: params,
    params
  })
}

// 修改
export function modifyCustomer(params={}) {
  const {
    id, // 商户id
    nickname,
    parentUserId,
    password
  } = params
  return request({
    url: '/customer/modify',
    method: 'post',
    data: params,
  })
}

// 新增排面标准值
export function pmStandardAdd(params={}) {
  // const {
  //   id, // 商户id
  //   nickname,
  //   parentUserId,
  //   password
  // } = params
  return request({
    url: '/customer/pm-standard-add',
    method: 'post',
    data: params,
  })
}

// 新增排面标准值
export function pmStandardAddBatch(params={}) {
  // const {
  //   id, // 商户id
  //   nickname,
  //   parentUserId,
  //   password
  // } = params
  return request({
    url: '/customer/pm-standard-add-batch',
    method: 'post',
    data: params,
  })
}

// 删除排面标准值
export function pmStandardDelete(params) {
  return request({
    url: '/customer/pm-standard-delete',
    method: 'post',
    params
  })
}

// pm-standard-list 查看客户所有排面标准值
export function pmStandardList(params={}) {
  // const {
  //   id, // 商户id
  //   nickname,
  //   parentUserId,
  //   password
  // } = params
  return request({
    url: '/customer/pm-standard-list',
    method: 'get',
    params,
  })
}

// /customer/pm-standard-modify修改排面标准值
export function pmStandardModify(params={}) {
  // const {
  //   id, // 商户id
  //   nickname,
  //   parentUserId,
  //   password
  // } = params
  return request({
    url: '/customer/pm-standard-modify',
    method: 'post',
    data: params,
  })
}

// /customer/pm-standard-view 查看用户指定指标的标准值
export function pmStandardView(params={}) {
  // const {
  //   id, // 商户id
  //   nickname,
  //   parentUserId,
  //   password
  // } = params
  return request({
    url: '/customer/pm-standard-view',
    method: 'get',
    data: params,
    params
  })


}


// 新增陈列规范值
export function displaySpecAdd(params) {
  return request({
    url: '/customer/displayspec-add',
    method: 'post',
    data: params,
  })
}

// 修改陈列规范值
export function displaySpecModify(params) {
  return request({
    url: '/customer/displayspec-modify',
    method: 'post',
    data: params,
  })
}

// 查看陈列规范值
export function displaySpecGet(params) {
  return request({
    url: '/customer/displayspec-list',
    method: 'GET',
    params
  })
}

// 删除陈列规范值
export function displaySpecDel(params) {
  return request({
    url: '/customer/displayspec-delete',
    method: 'POST',
    params
  })
}







